function a(a, t, e) {
    return t in a ? Object.defineProperty(a, t, {
        value: e,
        enumerable: !0,
        configurable: !0,
        writable: !0
    }) : a[t] = e, a;
}

var t, e = require("../../utils/api.js"), o = getApp(), s = require("../../utils/disapi.js");

require("../../utils/base64.js");

Page((t = {
    data: {
        program: !0,
        imgHeights: [],
        cur: 0,
        heading: "团购",
        headingColor: "#ffffff",
        headingBg: "#F75451",
        hide: !1,
        page: 2,
        authorize: !1,
        Banner: [],
        indicatorDots: "1",
        buyPrepeo: [],
        bp_status: 0,
        items: {},
        info: [],
        bought_img: [],
        time: !0,
        sell_out: !1,
        carnum: "",
        spike: "",
        Seckill: !1,
        mscur: "curgoods",
        is_open_spike: 0,
        show: !1,
        stickyFlag: !1,
        loading: !0,
        none: "block",
        nones: "none",
        footer: [],
        tabsCurr: 0,
        tabsCurrs: 0,
        goodsTab: [],
        cid: "",
        url: "",
        showOfficeAccount: !1,
        bgcolor: "xx",
        showMod: !1,
        history: [],
        now_head: "",
        last_head_notice: [],
        index_share_set: [],
        showgoodsid: [],
        showLoding: !1,
        showlodingmore: {
            showMore: !0,
            noMore: !1
        },
        mid: !1,
        showSuccesstipInfo: {
            showSuccesstip: !0,
            title: "已加入购物车",
            type: !0
        },
        bannerIndex: 1,
        del_id: "",
        nomoreinfo: [],
        share: !1,
        showCopy: !1,
        is_open_full_reduction: 0,
        full_reduction_limit_price: "",
        full_reduction_price: "",
        showLimit: 4,
        playBtn: "/images/playvideo.png",
        is_open_video: 1,
        curtime: "curgoods",
        showAds: !1,
        adsInfo: []
    },
    onReady: function() {},
    onPullDownRefresh: function() {
        var a = this;
        a.setData({
            showLoding: !1,
            page: 2
        }), a.loads(a.data.op);
    },
    onShow: function() {
        this.setData({
            showOfficeAccount: !1
        });
    },
    onLoad: function(a) {
        var t = this, e = this, a = a;
        o.globalData.openid ? (e.setData({
            getopenid: !0
        }), e.data.getopenid && e.entertype(a)) : o.getopenidBack = function(o) {
            t.setData({
                getopenid: !0
            }), e.data.getopenid && e.entertype(a);
        };
    },
    entertype: function(a) {
        var t = this;
        if (console.log(a), a.scene) {
            var s = decodeURIComponent(a.scene), n = s.split("#")[0], d = (s.split("#")[1], 
            {
                openid: o.globalData.openid,
                head_mid: n
            });
            e.selectShareHead(d).then(function(e) {
                console.log(e), 0 == e.errno && (t.setData({
                    head: e.data
                }), t.loads(a)), t.setData({
                    items: e.data,
                    hide: !0
                });
            });
        } else if (a.mid) {
            var n = a.mid, d = {
                openid: o.globalData.openid,
                head_mid: n
            };
            e.selectShareHead(d).then(function(e) {
                console.log(e), 0 == e.errno && (t.setData({
                    head: e.data
                }), t.loads(a)), t.setData({
                    items: e.data,
                    hide: !0
                });
            });
        } else 1 == a.goindex ? t.loads(a) : e.getMember({
            openid: o.globalData.openid
        }).then(function(e) {
            console.log(e), 0 != e.errno || null == e.data.m_head_openid || "" == e.data.m_head_openid || "null" == e.data.m_head_openid || void 0 == e.data.m_head_openid ? wx.reLaunch({
                url: "/pages/group/groupList?entertype=1"
            }) : t.loads(a);
        });
    },
    loads: function(t) {
        var n, d = this;
        d.setData((n = {
            data_end_show_img: o.globalData.data_end_show_img,
            default_img_small: o.globalData.default_small_img,
            op: t,
            enterFirst: o.globalData.enterFirst,
            data_end_show_img_open: o.globalData.data_end_show_img_open,
            default_img_big: o.globalData.default_big_img
        }, a(n, "default_img_small", o.globalData.default_small_img), a(n, "showOfficeAccount", !0), 
        n)), console.log(d.data.default_img_big), setTimeout(function() {
            d.setData({
                program: !1
            });
        }, 5e3);
        for (var i = getCurrentPages(), r = "/" + i[i.length - 1].route, l = 0; l < d.data.footer.length; l++) r == d.data.footer[l].url && (d.data.footer[l].nav = 2);
        if (d.setData({
            footer: d.data.footer
        }), t.scene) {
            var g = decodeURIComponent(t.scene);
            console.log(g), 0 != t.count && wx.setStorage({
                key: "share_scene",
                data: {
                    scene: t.scene,
                    count: 0
                }
            }), t.p_id = g.split("#")[1], t.m_id = g.split("#")[0];
        }
        var c = t && t.p_id ? t.p_id : "";
        if (e.getIndexData({
            openid: o.globalData.openid
        }).then(function(t) {
            if (console.log(t), 0 == t.errno) {
                if (wx.setStorage({
                    key: "indexData",
                    data: t.data
                }), o.globalData.full_reduction_price = t.data.full_reduce.full_reduction_price, 
                o.globalData.full_reduction_limit_price = t.data.full_reduce.full_reduction_limit_price, 
                o.globalData.is_open_full_reduction = t.data.full_reduce.is_open_full_reduction, 
                d.setData({
                    netBreak: !1,
                    full_reduction_price: o.globalData.full_reduction_price,
                    full_reduction_limit_price: o.globalData.full_reduction_limit_price,
                    is_open_full_reduction: o.globalData.is_open_full_reduction,
                    memberTicket: t.data.new_member_ticket ? t.data.new_member_ticket : ""
                }), d.data.memberTicket.is_open && 1 == d.data.memberTicket.is_open) {
                    var s = d.data.memberTicket.ticket, n = parseFloat(s.use_limit), i = s.cut_price.split(".");
                    setTimeout(function() {
                        d.setData({
                            showyouhui: !0,
                            "memberTicket.ticket.use_limit": n,
                            "memberTicket.ticket.price": i,
                            showAds: !1
                        });
                    }, 1500);
                }
                for (var r = t.data.data.data, l = "showlodingmore.noMore", g = 0; g < r.length; g++) if ("goods" == r[g].name) {
                    if (r[g].params.goods.length && r[g].params.goods.length < 10) {
                        var c;
                        d.setData((c = {}, a(c, "showlodingmore.showMore", !1), a(c, l, !0), a(c, "mid", !0), 
                        c));
                    }
                    break;
                }
                for (var u = d.data.showLimit, p = t.data.full_reduce.full_reduction_goods ? t.data.full_reduce.full_reduction_goods : [], h = [], f = [], m = 0; m < p.length; m++) 0 == p[m].num && (f.push(p[m]), 
                p.splice(m, 1));
                var _ = p.concat(f);
                if (_.length && _.length <= u) h = h.concat(_); else for (var v = 0; v < u; v++) _[v] && h.push(_[v]);
                d.setData({
                    fullReduceGoods: h,
                    allFullReduceGoods: _
                }), wx.setNavigationBarTitle({
                    title: t.data.top.title
                }), wx.setNavigationBarColor({
                    frontColor: t.data.top.topcolor,
                    backgroundColor: t.data.top.topbg
                }), wx.setStorage({
                    key: "basic",
                    data: t.data.top
                });
                var w = t.data.bottom_nav;
                if (wx.setStorage({
                    key: "nav",
                    data: t.data.bottom_nav
                }), "" != w) for (var D = getCurrentPages(), b = "/" + D[D.length - 1].route, x = 0; x < w.params.data.length; x++) b == w.params.data[x].url && (w.params.data[x].nav = 2, 
                w.params.nav = 2);
                for (var T = t.data.data.data, x = 0; x < T.length; x++) {
                    if ("seckill" == T[x].name && T[x].id) {
                        var k = x;
                        e.Seckillindex({
                            openid: o.globalData.openid
                        }).then(function(a) {
                            if (console.log(a), 0 == a.errno) {
                                if (o.globalData.is_open_spike = 1, o.globalData.user_spike = T[k].params, a.data.currentgoods.length && a.data.currentgoods.length > 0 || a.data.currentgoods.goods && a.data.currentgoods.goods.length && a.data.currentgoods.goods.length > 0) var t = a.data.currentgoods, e = "overgoods" + parseInt(a.data.overgoods.length - 2), s = "curgoods"; else {
                                    t = a.data.aftergoods.length && a.data.aftergoods.length > 0 ? a.data.aftergoods[0] : a.data.overgoods[0];
                                    if (a.data.overgoods.length && 0 == a.data.overgoods.length) e = "aftergoods0"; else if (a.data.aftergoods.length && 0 == a.data.aftergoods.length) e = "overgoods" + a.data.overgoods.length; else e = "aftergoods0";
                                    s = a.data.aftergoods.length && a.data.aftergoods.length > 0 ? "aftergoods0" : "overgoods0";
                                }
                                d.setData({
                                    is_open_spike: 1,
                                    seckill: T[k].params,
                                    seckillGoods: a.data,
                                    curSeckillGoods: t,
                                    ind: a.data.aftergoods.length ? a.data.aftergoods.length : 0,
                                    curtime: e,
                                    mscur: s
                                });
                            } else d.setData({
                                is_open_spike: 0
                            });
                        });
                    }
                    if ("goods" == T[x].name) for (var y = 0; y < r.length; y++) if ("goods" == r[y].name) {
                        if ("block" == d.data.none) {
                            if (T[x].params.goods.length < 10 || void 0 == T[x].params.goods.length) {
                                var I;
                                r[y].params.goods = T[x].params.goods, d.setData((I = {}, a(I, "showlodingmore.showMore", !1), 
                                a(I, l, !0), I));
                            }
                            r[y].params.goods = T[x].params.goods;
                        }
                        break;
                    }
                    if ("diyadswindow" == T[x].name && o.globalData.loadAds) {
                        var S = d.data.adsInfo, C = {
                            data: T[x].params.data[0],
                            show: !1
                        };
                        S.push(C), d.setData({
                            adsInfo: S
                        }), setTimeout(function() {
                            d.setData(a({}, "adsInfo[0].show", !0)), wx.setStorage({
                                key: "adsInfo",
                                data: d.data.adsInfo
                            });
                        }, 1500);
                    } else wx.getStorage({
                        key: "adsInfo",
                        success: function(a) {
                            d.setData({
                                adsInfo: a.data
                            });
                        }
                    });
                }
                o.globalData.loadAds = !1, d.setData({
                    info: t.data.data.data,
                    footer: w,
                    head: d.data.head ? d.data.head : t.data.head,
                    buyPrepeo: t.data.data.buy_people && t.data.data.buy_people.length ? t.data.data.buy_people : [],
                    bg: t.data.data.basic.allbg,
                    last_head_notice: t.data.last_head_notice,
                    index_share_set: t.data.index_share_set,
                    showLoding: !0
                }), wx.stopPullDownRefresh(), t.data.history && t.data.history.length > 0 && 1 == o.globalData.index_show_mod && (d.setData({
                    showMod: !0,
                    history: t.data.history,
                    now_head: t.data.history[0].m_openid
                }), o.globalData.index_show_mod = 2), setInterval(function() {
                    d.countDown();
                }, 1e3);
            } else wx.navigateTo({
                url: "/pages/template/netOverTime"
            });
        }).catch(function(a) {
            console.log(a), wx.showToast({
                title: "获取数据失败,请删除小程序或清除手机小程序进程再次进入！",
                icon: "none",
                duration: 5e3,
                mask: !0
            });
        }), wx.getStorageSync("cartnum") ? d.setData({
            carnum: wx.getStorageSync("cartnum")
        }) : e.getCartNum({
            openid: o.globalData.openid
        }).then(function(a) {
            console.log(a), wx.setStorageSync("cartnum", a.data), d.setData({
                carnum: wx.getStorageSync("cartnum")
            });
        }), e.getTeamOpenid({
            openid: o.globalData.openid
        }).then(function(a) {
            console.log(a), "" == a.data.user.m_head_openid || void 0 == a.data.user.m_head_openid || (d.setData({
                items: a.data.head_info,
                hide: !0,
                user: a.data.user,
                headInfo: a.data.head_info
            }), wx.setStorage({
                key: "head_info",
                data: a.data
            }));
        }), "" != c && void 0 != c) {
            var u = o.globalData.openid;
            s.get_group_bing({
                openid: u,
                pid: c
            }).then(function(a) {
                console.log(a);
            });
        }
        e.getMember({
            openid: wx.getStorageSync("openid")
        }).then(function(a) {
            console.log(a), u = a.data.m_head_openid, d.setData({
                member: a.data
            });
        });
        var p = 0;
        setInterval(function() {
            p == d.data.buyPrepeo.length - 1 ? p = 0 : p++, d.setData({
                bp_status: p
            });
        }, 5e3);
    },
    add: function(t) {
        console.log(t);
        var o = this, s = o.data.info, n = t.currentTarget.dataset.limit, d = t.currentTarget.dataset.stock, i = Math.min(parseInt(n), parseInt(d)), r = t.currentTarget.dataset.id, l = t.currentTarget.dataset.atid, g = {
            gid: r,
            num: 1,
            openid: wx.getStorageSync("openid"),
            at_id: l
        };
        n = parseInt(n), d = parseInt(d), console.log(i, n, d);
        for (var c = 0; c < o.data.info.length; c++) if ("goods" == s[c].name) var u = s[c].params, p = c;
        for (var h = 0; h < u.goods.length; h++) {
            var f = "info[" + p + "].params.goods[" + h + "].isshowbtn", m = "info[" + p + "].params.goods[" + h + "].curGoodsNum", _ = o.data.info[p].params.goods[h].curGoodsNum;
            if (_ = parseInt(_), u.goods[h].g_id == r) {
                var v = "info[" + p + "].params.goods[" + h + "].cart_id";
                if (_ < i && n > 0) {
                    var w;
                    o.setData((w = {}, a(w, f, 2), a(w, m, _ + 1), w));
                } else if (_ < d && 0 == n) {
                    var D;
                    o.setData((D = {}, a(D, f, 2), a(D, m, _ + 1), D));
                } else {
                    if (_ >= n) return console.log(n, _), void wx.showToast({
                        title: "商品限购" + n + "件哦",
                        icon: "none",
                        duration: 2e3
                    });
                    if (_ >= d) return void wx.showToast({
                        title: "商品数量没有那么多了",
                        icon: "none",
                        duration: 2e3
                    });
                }
            }
        }
        e.addCart(g).then(function(t) {
            console.log(t);
            t.data.showbtn, t.data.count;
            var e = t.data.id;
            if (0 == t.errno) {
                for (var s = u.goods, n = 0; n < s.length; n++) console.log(s[n].g_id), s[n].g_id == r && (console.log(s[n]), 
                o.setData(a({}, v, e)));
                o.successtip(), wx.setStorage({
                    key: "cartnum",
                    data: parseInt(t.data.count)
                }), console.log(v, e), o.setData({
                    carnum: t.data.count
                }), console.log(o.data.info[cur].params.goods[h].cart_id), wx.setStorageSync("carnum", t.data.count), 
                0 != t.data.count ? (wx.showTabBarRedDot({
                    index: 2
                }), wx.setTabBarBadge({
                    index: 2,
                    text: t.data.count + ""
                })) : wx.hideTabBarRedDot({
                    index: 2
                });
            } else wx.showToast({
                title: t.message,
                icon: "none",
                duration: 2e3
            });
        });
    },
    redu: function(t) {
        for (var s = this, n = s.data.info, d = 0; d < s.data.info.length; d++) if ("goods" == n[d].name) var i = n[d].params, r = d;
        for (var l = t.currentTarget.dataset.id, g = (t.currentTarget.dataset.atid, t.currentTarget.dataset.cid), c = 0; c < i.goods.length; c++) if (i.goods[c].g_id == l) var u = "info[" + r + "].params.goods[" + c + "].isshowbtn", p = "info[" + r + "].params.goods[" + c + "].curGoodsNum", h = s.data.info[r].params.goods[c].curGoodsNum, c = c;
        console.log(g, h), (h = parseInt(h) - 1) > 0 ? e.savecart({
            id: g,
            num: h,
            act: "down",
            openid: o.globalData.openid
        }).then(function(t) {
            if (console.log(t), 0 == t.errno) {
                var e;
                s.setData((e = {
                    carnum: parseInt(t.data)
                }, a(e, u, 2), a(e, p, parseInt(h)), e)), console.log(s.data.carnum), wx.setStorage({
                    key: "cartnum",
                    data: parseInt(t.data)
                });
            }
        }) : (console.log(g, h), e.cartGoodsDel({
            id: g,
            openid: o.globalData.openid
        }).then(function(t) {
            if (console.log(t), 0 == t.errno) {
                var e;
                console.log(t), s.setData((e = {
                    carnum: t.data
                }, a(e, u, 1), a(e, p, 0), e)), wx.setStorageSync("cartnum", parseInt(t.data));
            }
        }));
    },
    bannerchange: function(a) {
        console.log(a);
        var t = this, e = a.detail.current;
        t.setData({
            indicatorDots: e + 1
        });
    },
    onCloseButton: function(a) {
        this.setData({
            show: !this.data.show
        });
    },
    onPageScroll: function(a) {
        !this.data.stickyFlag && a.scrollTop > 300 && this.setData({
            stickyFlag: !0
        }), a.scrollTop <= 300 && this.setData({
            stickyFlag: !1
        });
    },
    backTop: function() {
        this.setData({
            stickyFlag: !1
        }), wx.pageScrollTo({
            scrollTop: 0
        });
    },
    onChange: function(t) {
        var s, n = this, d = "showlodingmore.noMore";
        console.log(t), console.log(n.data), n.setData((s = {}, a(s, "showlodingmore.showMore", !0), 
        a(s, d, !1), s));
        var i = n.data.info, r = t.detail.c_id;
        n.data.page;
        console.log(i), e.getIndexData({
            openid: o.globalData.openid,
            cid: r,
            page: 1
        }).then(function(t) {
            if (n.setData({
                mid: !1
            }), 0 == t.errno) {
                n.setData({
                    nomoreinfo: []
                }), console.log(t);
                for (var e = t.data.data.data, o = 0; o < e.length; o++) if ("goods" == e[o].name) {
                    for (var s = 0; s < i.length; s++) {
                        if ("goods" == i[s].name && -10 != r) {
                            if (console.log(t), "block" == n.data.none) {
                                if (e[o].params.goods.length < 10 || void 0 == e[o].params.goods.length) {
                                    var l;
                                    i[s].params.goods = e[o].params.goods, n.setData((l = {}, a(l, "showlodingmore.showMore", !1), 
                                    a(l, d, !0), l));
                                }
                                i[s].params.goods = e[o].params.goods;
                            } else i[s].params.after_goods = e[o].params.after_goods;
                            n.setData({
                                info: i
                            });
                            break;
                        }
                        -10 == r && (console.log(n.data.fullReduceGoods), "block" == n.data.none ? (i[s].params.goods = n.data.fullReduceGoods, 
                        e[o].params.goods.length < 10 && (i[s].params.goods = n.data.fullReduceGoods)) : i[s].params.after_goods = e[o].params.after_goods, 
                        n.setData({
                            info: i
                        }));
                    }
                    break;
                }
                n.setData({
                    cid: r,
                    page: 2
                }), setInterval(function() {
                    n.countDown();
                }, 1e3);
            }
        }), console.log(t);
    },
    timeFormat: function(a) {
        return a < 10 ? "0" + a : a;
    },
    countDown: function() {
        var a = this, t = new Date().getTime(), e = a.data.info, o = [];
        for (var s in e) if ("goods" == e[s].name && void 0 != e[s].params.goods[0]) {
            var n = 1e3 * parseInt(e[s].params.goods[0].at_end_time);
            if (n - t > 0) {
                var d = (n - t) / 1e3, i = parseInt(d / 86400), r = parseInt(d % 86400 / 3600), l = parseInt(d % 86400 % 3600 / 60), g = parseInt(d % 86400 % 3600 % 60);
                o = {
                    day: this.timeFormat(i),
                    hou: this.timeFormat(r),
                    min: this.timeFormat(l),
                    sec: this.timeFormat(g)
                }, a.setData({
                    countDownList: o
                });
            }
        }
    },
    onReachBottom: function(t) {
        for (var s = this, n = (o.globalData.openid, s.data.page), d = s.data.info, i = s.data.cid, r = (s.data.mid, 
        "showlodingmore.showMore"), l = "showlodingmore.noMore", g = 1, c = 0; c < d.length; c++) if ("goods" == d[c].name) {
            var u;
            g = 2, s.setData((u = {}, a(u, r, !0), a(u, l, !1), u));
        }
        if (2 == g) {
            if (-10 == i) {
                var p = s.data.allFullReduceGoods, h = s.data.fullReduceGoods, f = s.data.info;
                console.log(f);
                for (var m = 0; m < f.length; m++) if ("goods" == f[m].name) f[m].params.goods;
                if (h.length >= p.length) {
                    var _;
                    s.setData((_ = {
                        mid: !0
                    }, a(_, r, !1), a(_, l, !0), _));
                } else {
                    for (var v, w = h.length; w < h.length + s.data.showLimit; w++) p[w] && h.push(p[w]);
                    h, s.setData((v = {
                        fullReduceGoods: h,
                        info: f
                    }, a(v, r, !1), a(v, l, !0), v));
                }
            }
            i >= 0 && e.getIndexData({
                openid: o.globalData.openid,
                page: n,
                cid: i
            }).then(function(t) {
                console.log(t);
                var e = t.data.data.data;
                if ("" != e) for (var o = 0; o < e.length; o++) if ("goods" == e[o].name) {
                    for (var i = 0; i < d.length; i++) if ("goods" == d[o].name) {
                        if ("block" == s.data.none) {
                            if (console.log(d[o].params.goods), void 0 == d[o].params.goods.length) c = d[o].params.goods; else c = d[o].params.goods.concat(e[o].params.goods);
                            if (console.log(c), d[o].params.goods = c, e[o].params.goods.length < 10 || void 0 == e[o].params.goods.length) {
                                var g;
                                console.log(e[o].params.goods.length), d[o].params.goods = c, s.setData((g = {}, 
                                a(g, r, !1), a(g, l, !0), g));
                            }
                        } else {
                            if (void 0 == d[o].params.after_goods.length) c = d[o].params.after_goods; else var c = d[o].params.after_goods.concat(e[o].params.after_goods);
                            if (d[o].params.after_goods = c, e[o].params.after_goods.length < 10 || void 0 == e[o].params.after_goods.length) {
                                var u;
                                console.log(e[o].params.after_goods.length), d[o].params.after_goods = c, s.setData((u = {}, 
                                a(u, r, !1), a(u, l, !0), u));
                            }
                        }
                        break;
                    }
                    break;
                }
                n = parseInt(n) + parseInt(1), s.setData(a({
                    info: d,
                    loading: !1,
                    page: n
                }, r, !1)), s.data.mid && s.setData(a({}, l, !0));
            });
        } else s.setData(a({}, r, !1));
    },
    telephone: function(a) {
        console.log(a);
        var t = a.currentTarget.dataset.phone;
        wx.makePhoneCall({
            phoneNumber: t
        });
    },
    onShareAppMessage: function(a) {
        var t = this, e = t.data.index_share_set, o = t.data.title, s = "";
        return 2 == e.img_type && (s = e.img), 2 == e.title_type && (o = e.title), console.log("/pages/template/index?p_id=" + t.data.member.m_id + "&&mid=" + t.data.head.m_id), 
        {
            title: o,
            path: "/pages/template/index?p_id=" + t.data.member.m_id + "&&mid=" + t.data.head.m_id,
            imageUrl: s,
            success: function(a) {
                t.shareClick();
            },
            fail: function(a) {
                wx.showToast({
                    title: "分享失败",
                    icon: "clear",
                    duration: 2e3
                });
            }
        };
    },
    site: function(a) {
        var t = this, e = t.data.info, o = a.currentTarget.dataset.index, s = a.currentTarget.dataset.data_index, n = e[o].params.data[s].type, d = e[o].params.data[s].url;
        "url" == n ? wx.navigateTo({
            url: d
        }) : "tel" == n ? wx.makePhoneCall({
            phoneNumber: d
        }) : "out_link" == n ? (t.setData({
            url: d
        }), wx.navigateTo({
            url: "/pages/template/out_h5"
        })) : "app" == n && wx.navigateToMiniProgram({
            appId: e[o].params.data[s].url_name,
            path: d,
            envVersion: "develop",
            success: function(a) {}
        });
    },
    jump: function(a) {
        var t = this.data.info, e = a.currentTarget.dataset.index, o = t[e].params.type, s = t[e].params.url;
        "url" == o ? wx.navigateTo({
            url: s
        }) : "tel" == o ? wx.makePhoneCall({
            phoneNumber: s
        }) : "out_link" == o ? wx.navigateTo({
            url: "/pages/template/out_h5?url=" + s
        }) : "app" == o && wx.navigateToMiniProgram({
            appId: t[e].params.url_name,
            path: s,
            envVersion: "develop",
            success: function(a) {}
        });
    },
    handleProxy: function(a) {
        var t = this;
        1 == a.currentTarget.dataset.type ? t.setData({
            none: "none",
            nones: "block",
            goodsType: 1
        }) : t.setData({
            none: "block",
            nones: "none",
            goodsType: 2
        });
    }
}, a(t, "onCloseButton", function(a) {
    this.setData({
        specShow: !this.data.specShow
    });
}), a(t, "addSpec", function(a) {
    console.log(a);
    var t = this, s = o.globalData.openid, n = a.currentTarget.dataset.id, d = a.currentTarget.dataset.atid;
    t.setData({
        atid: d
    }), console.log(t.data.atid), e.GetSpecInfo({
        openid: s,
        id: n
    }).then(function(a) {
        if (console.log(a), 0 == a.errno) {
            var o = [], n = [];
            console.log(a.data.spec);
            for (var i in a.data.spec) {
                var r = [], l = [];
                n[i] = {
                    id: a.data.spec[i].id,
                    subSpec: a.data.spec[i].item[0].gsi_id
                };
                for (var g in a.data.spec[i].item) r[g] = a.data.spec[i].item[g].gsi_title, l[g] = a.data.spec[i].item[g].gsi_id;
                o[i] = {
                    id: a.data.spec[i].id,
                    name: a.data.spec[i].title,
                    stem: r,
                    stem_id: l
                };
            }
            for (var c = "", i = n.length - 1; i >= 0; i--) c += "," + n[i].subSpec;
            console.log(c, a.data.goods.g_id), e.GetSpecDeatail({
                openid: s,
                id_str: c,
                gid: a.data.goods.g_id
            }).then(function(e) {
                if (console.log(e), 0 == e.errno) {
                    var s = e.data.ggo_market_price.split("."), i = a.data.goods.g_limit_num <= 0 ? e.data.ggo_stock : parseInt(a.data.goods.g_limit_num) < parseInt(e.data.ggo_stock) ? a.data.goods.g_limit_num : e.data.ggo_stock, r = {
                        id: a.data.goods.g_id,
                        name: a.data.goods.g_name,
                        photo: a.data.goods.g_icon,
                        specInfo: e.data.ggo_title,
                        price: s,
                        oldPrice: e.data.ggo_old_price,
                        num: 1,
                        popup: o,
                        count: e.data.ggo_stock,
                        limit: i,
                        is_limit: a.data.goods.g_limit_num,
                        ggo_id: e.data.ggo_id
                    };
                    console.log(d), t.setData({
                        specDetail: r,
                        specShow: !t.data.specShow,
                        specDefault: n
                    }), onsole.log(t.data.atid);
                } else console.log(e.message), wx.showToast({
                    title: a.message,
                    icon: "none"
                });
            });
        } else console.log(a.message), wx.showToast({
            title: a.message,
            icon: "none"
        });
    });
}), a(t, "popup", function(a) {
    for (var t = this, s = a.currentTarget.dataset.id, n = a.currentTarget.dataset.subid, d = t.data.specDefault, i = "", r = d.length - 1; r >= 0; r--) d[r].id == s && (d[r].subSpec = n, 
    t.setData({
        specDefault: d
    })), i += "," + d[r].subSpec;
    var l = o.globalData.openid, g = t.data.specDetail;
    e.GetSpecDeatail({
        openid: l,
        id_str: i,
        gid: g.id
    }).then(function(a) {
        if (0 == a.errno) {
            var e = a.data.ggo_market_price.split("."), o = g.is_limit <= 0 ? a.data.ggo_stock : parseInt(g.is_limit) < parseInt(a.data.ggo_stock) ? g.is_limit : a.data.ggo_stock;
            g.specInfo = a.data.ggo_title, g.price = e, g.oldPrice = a.data.ggo_old_price, g.count = a.data.ggo_stock, 
            g.limit = o, g.ggo_id = a.data.ggo_id, g.num = 1, t.setData({
                specDetail: g
            });
        } else wx.showToast({
            title: res.message,
            icon: "none"
        });
    });
}), a(t, "specOnChange", function(a) {
    console.log(a);
    var t = a.detail, e = this, o = e.data.specDetail;
    o.num = t, e.setData({
        specDetail: o
    });
}), a(t, "specAddCart", function(t) {
    for (var s = this, n = t.currentTarget.dataset.id, d = t.currentTarget.dataset.optionid, i = t.currentTarget.dataset.num, r = t.currentTarget.dataset.atid, l = s.data.info, g = t.currentTarget.dataset.limit, c = 0; c < s.data.info.length; c++) if ("goods" == l[c].name) var u = l[c].params, p = c;
    void 0 != r && "" != r || (r = s.data.atid);
    for (var h = 0; h < u.goods.length; h++) {
        var f = "info[" + p + "].params.goods[" + h + "].isshowbtn", m = "info[" + p + "].params.goods[" + h + "].curGoodsNum", _ = s.data.info[p].params.goods[h].curGoodsNum;
        if (u.goods[h].g_id == n) {
            var v = "info[" + p + "].params.goods[" + h + "].cart_id";
            if (!(0 == g || _ < g)) return void wx.showToast({
                title: "本商品限购" + g + "件",
                icon: "none",
                duration: 2e3
            });
            var w;
            s.setData((w = {}, a(w, f, 2), a(w, m, parseInt(_) + i), w));
        }
    }
    e.SpecAddCart({
        openid: o.globalData.openid,
        gid: n,
        ggoid: d,
        num: i,
        at_id: r
    }).then(function(t) {
        if (console.log(t), 0 == t.errno) {
            for (var e = t.data.id, o = u.goods, d = 0; d < o.length; d++) o[d].g_id == n && s.setData(a({}, v, e));
            s.successtip(), 0 != t.data.count ? (wx.showTabBarRedDot({
                index: 2
            }), wx.setTabBarBadge({
                index: 2,
                text: t.data.count + ""
            })) : wx.hideTabBarRedDot({
                index: 2
            }), s.setData({
                specShow: !1,
                carnum: t.data.count
            }), wx.setStorageSync({
                key: "cartnum",
                data: parseInt(t.data.count)
            });
        } else wx.showToast({
            title: t.message,
            icon: "none",
            duration: 2e3
        });
    });
}), a(t, "sites", function(a) {
    var t = this;
    console.log(a);
    var e = a.currentTarget.dataset.data_index, o = t.data.footer, s = [ "/pages/template/index", "/pages/template/classify", "/pages/template/cart", "/pages/personal/personal" ];
    "url" == o.params.data[e].type ? s.includes(o.params.data[e].url) ? wx.reLaunch({
        url: o.params.data[e].url,
        success: function() {
            t.setData({
                showLoding: !0
            });
        }
    }) : wx.navigateTo({
        url: o.params.data[e].url,
        success: function() {
            t.setData({
                showLoding: !0
            });
        }
    }) : "tel" == o.params.data[e].type ? wx.makePhoneCall({
        phoneNumber: o.params.data[e].url
    }) : "out_link" == o.params.data[e].type ? wx.navigateTo({
        url: "/pages/template/out_h5?url=" + o.params.data[e].url
    }) : "app" == o.params.data[e].type && wx.navigateToMiniProgram({
        appId: o.params.data[e].url_name,
        path: o.params.data[e].url,
        envVersion: "develop"
    });
}), a(t, "changeHead", function(a) {
    wx.navigateTo({
        url: "/pages/group/groupList"
    });
}), a(t, "hideMod", function() {
    this.setData({
        showMod: !1
    });
}), a(t, "test", function() {
    return !1;
}), a(t, "select_add", function(a) {
    console.log(a);
    for (var t = this, e = a.currentTarget.dataset.mid, o = t.data.history, s = t.data.now_head, n = t.data.head, d = 0; d < o.length; d++) o[d].m_id == e ? (o[d].checked = !0, 
    s = o[d].m_openid) : o[d].checked = !1;
    n.checked = !1, t.setData({
        history: o,
        now_head: s,
        head: n
    });
}), a(t, "select_add_now", function(a) {
    console.log(a);
    for (var t = this, e = (a.currentTarget.dataset.mid, t.data.history), o = t.data.now_head, s = t.data.head, n = 0; n < e.length; n++) e[n].checked = !1;
    s.checked = !0, t.setData({
        history: e,
        now_head: o,
        head: s
    });
}), a(t, "select_head", function(a) {
    var t = this, s = t.data.now_head, n = t.data.head;
    1 == n.checked && (s = n.m_openid);
    var d = o.globalData.openid;
    e.selectHead({
        openid: d,
        head_openid: s
    }).then(function(a) {
        0 == a.errno && t.setData({
            head: a.data,
            showMod: !1
        });
    });
}), a(t, "scrollImagesChange", function(a) {
    this.setData({
        bannerIndex: a.detail.current + 1,
        cur: a.detail.current
    });
}), a(t, "onChangeGoodsnum", function(a) {
    console.log(2);
    var t = this, s = a.currentTarget.dataset.id, n = a.currentTarget.dataset.cid, d = a.currentTarget.dataset.old, i = a.detail;
    if (d < i) r = "up"; else var r = "down";
    e.savecart({
        id: n,
        num: i,
        act: r,
        openid: o.globalData.openid
    }).then(function(a) {
        console.log(a);
        var e = t.data.goodList;
        if (1 == a.errno) ; else {
            for (var o = 0; o < e.length; o++) e[o].c_id == s && (e[o].count = i);
            t.setData({
                carnum: a.data,
                cur_id: s,
                cur_cid: n
            }), console.log(a.data), wx.setStorageSync("cartnum", a.data);
        }
        t.calculateTotal();
    });
}), a(t, "overlimit", function(a) {
    console.log(a);
    var t = this, e = t.data.cur_cid;
    console.log(e), void 0 == e && wx.showToast({
        title: "超出可购买数量了",
        icon: "none",
        duration: 2e3
    }), t.setData({
        delStatus: !this.data.delStatus,
        del_id: e
    });
}), a(t, "goodsorder", function(a) {
    for (var t = this, e = a, o = 0; o < e.data.data.data.length; o++) if ("goods" == e.data.data.data[o].name) {
        var s = e.data.data.data[o].params.goods;
        break;
    }
    console.log(t.data.nomoreinfo, s);
    for (var n = [], d = t.data.nomoreinfo, i = 0; i < s.length; i++) 0 != s[i].num ? n.push(s[i]) : d.push(s[i]);
    t.setData({
        nomoreinfo: d
    }), console.log(t.data.nomoreinfo), s.splice(0, s.length), s.push.apply(s, n), console.log(e.data.data.data[4].params.goods);
}), a(t, "share", function(a) {
    console.log(a), this.setData({
        share: !0
    });
}), a(t, "shareClose", function() {
    this.setData({
        share: !1
    });
}), a(t, "copyinfo", function() {
    var a = this, t = [];
    console.log(a.data);
    for (var e = 0; e < a.data.info.length; e++) if ("goods" == a.data.info[e].name) var o = a.data.info[e].params.goods;
    var s = o.length >= 10 ? 10 : o.length;
    console.log(s);
    for (var n = 0; n < s; n++) t.push({
        name: o[n].g_name,
        price: o[n].g_price,
        index: n + 1
    });
    a.setData({
        goodsInfo: t,
        showCopy: !0,
        share: !1
    }), console.log(a.data.goodsInfo);
}), a(t, "closeshowCopy", function() {
    this.setData({
        showCopy: !1
    });
}), a(t, "copycontent", function() {
    var a = this, t = a.data.goodsInfo;
    console.log(t);
    for (var e = "团长：" + a.data.head.m_name + "\n自提点：" + a.data.head.m_head_address + "\n【【【今日推荐】】】\n", o = 0; o < t.length; o++) e += t[o].index + ". 【" + t[o].name + "】 " + t[o].price + "元\n";
    console.log(e), wx.setClipboardData({
        data: e,
        success: function(t) {
            wx.getClipboardData({
                success: function(t) {
                    console.log(t.data), a.setData({
                        showCopy: !1
                    });
                }
            });
        }
    });
}), a(t, "moveposition", function() {
    console.log(1);
}), a(t, "circle", function() {
    wx.navigateTo({
        url: "/pages/goods/share"
    });
}), a(t, "wechat", function() {
    wx.getShareInfo();
}), a(t, "imgload", function(a) {
    var t = this, e = a.currentTarget.dataset.data_index, o = a.detail.height, s = (a.detail.width, 
    this.data.imgHeights);
    s[e] = o, t.setData({
        imgHeights: s
    });
}), a(t, "imgchange", function(a) {
    console.log(a);
    var t = this;
    t.setData({
        cur: a.detail.current
    }), console.log(t.data.cur);
}), a(t, "mschange", function(a) {
    var t = this;
    console.log(a);
    var e = a.currentTarget.dataset.index || 0 == a.currentTarget.dataset.index ? a.currentTarget.dataset.index : "", o = a.currentTarget.dataset.ms_id;
    if (console.log(o, e), "overgoods" == o) s = t.data.seckillGoods.overgoods[e];
    if ("curgoods" == o) s = t.data.seckillGoods.currentgoods;
    if ("aftergoods" == o) var s = t.data.seckillGoods.aftergoods[e];
    console.log(s), t.setData({
        mscur: o + e,
        curSeckillGoods: s
    });
}), a(t, "playvideo", function(a) {
    console.log(a);
    var t = this, e = a.currentTarget.dataset.url;
    "banner" == (a.currentTarget.dataset.resource ? a.currentTarget.dataset.resource : "") ? t.setData({
        videourl: e,
        showvideo: !0,
        autoplay: !0
    }) : wx.navigateTo({
        url: e
    });
}), a(t, "closevideo", function() {
    this.setData({
        showvideo: !1
    });
}), a(t, "closeyouhui", function(a) {
    this.setData({
        showyouhui: !1,
        showAds: !0
    });
}), a(t, "tel", function(a) {
    var t = this;
    wx.navigateTo({
        url: "/pages/template/couponHall",
        success: function() {
            setTimeout(function() {
                t.setData({
                    showAds: !0,
                    itemone: !0,
                    showyouhui: !1
                });
            }, 1e3);
        }
    });
}), a(t, "closeAds", function(t) {
    var e = this, s = t.currentTarget.dataset.index, n = parseInt(s) + 1, d = "adsInfo[" + s + "].show", i = "adsInfo[" + n + "].show";
    console.log(s), e.setData(a({}, d, !1)), e.data.adsInfo[n] ? e.setData(a({}, i, !0)) : o.globalData.enterFirst = !1, 
    wx.setStorage({
        key: "adsInfo",
        data: e.data.adsInfo
    });
}), a(t, "toAds", function(t) {
    var e = this, s = t.currentTarget.dataset.url, n = t.currentTarget.dataset.index, d = parseInt(n) + 1, i = "adsInfo[" + n + "].show", r = "adsInfo[" + d + "].show";
    console.log(n), e.setData(a({}, i, !1)), e.data.adsInfo[d] ? e.setData(a({}, r, !0)) : o.globalData.enterFirst = !1, 
    wx.setStorage({
        key: "adsInfo",
        data: e.data.adsInfo
    }), wx.navigateTo({
        url: s
    });
}), a(t, "diyImgLoad", function(a) {
    console.log(a);
    var t = this;
    t.data.showyouhui || t.setData({
        showAds: !0
    });
}), a(t, "successtip", function() {
    arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
    var t = this;
    t.setData(a({}, "showSuccesstipInfo.showSuccesstip", !t.data.showSuccesstipInfo.showSuccesstip)), 
    setTimeout(function() {
        t.setData(a({}, "showSuccesstipInfo.showSuccesstip", !t.data.showSuccesstipInfo.showSuccesstip));
    }, 1300);
}), a(t, "stop", function() {}), t));